<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!--360浏览器优先以webkit内核解析-->
	<title>FASTPAY</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link href="../../../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
	<link href="../../../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
	<link href="../../../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
	<link href="../../../static/css/main/style.min862f.css" th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
	<link href="../../../static/pay/css/money_in.css" th:href="@{/pay/css/money_in.css}" rel="stylesheet"/>
	<style>

		.info-line-item{
			float:left;width:50%;font-size:16px; color:black; padding: 4px 0px
		}
	</style>
</head>

<body class="gray-bg">

<div class="wrapper wrapper-content">
	<div class="row"  id="dataBox">
		<div class="col-sm-12">
			<div class="col-sm-12">
				<div>
					<p style="font-size:16px; color:#425668">
						<label data-toggle="collapse">
							汇率加价
						</label>
						<label class="pull-right">
							&nbsp
						</label>
					</p>
				</div>
			</div>
			<div class="lv2-border col-sm-12" style="min-height:600px;">
				<div class="col-sm-12">
					<div>
						<p style="font-size:12px; color:#425668">
							<label data-toggle="collapse">
								实时汇率:<label>{{this_rate}}</label>
							</label>
							<label class="pull-right">
								&nbsp
							</label>
						</p>
					</div>
				</div>
				<div class="col-sm-12">
					<div>
						<p style="font-size:12px; color:#425668">
							<label data-toggle="collapse">
								当前增加汇率:<label>{{old_add_rate}}</label>
							</label>
							<label class="pull-right">
								&nbsp
							</label>
						</p>
					</div>
				</div>
				<div class="col-sm-12">
					<div class="col-sm-3"></div>
					<div class="col-sm-4">
						<div class="col-sm-12" style="min-width:600px;">
							<div class="col-sm-12" style="margin-top: 200px;">
								<div class="col-sm-12">
									<p class="col-sm-6" style="font-size:16px; color:black; padding: 10px 0px ">
										价位调整
									</p>
									<div style="float:left;width:220px;">
										<p  @click="jian" style="float:left;width:60px;font-size:16px; background:#73879c;color:white; padding: 15px 0px;text-align:center ">
											-
										</p>
										<p style="width:100px;float:left;font-size:16px;color:black; padding: 15px 0px; text-align:center">
											{{change}}
										</p>
										<p @click="add" style=" float:left;width:60px;font-size:16px; background:green;color:white; padding: 15px 0px;text-align:center ">
											+
										</p>
									</div>
								</div>

								<div class="col-sm-12">
									<p class="info-line-item">
										增加值
									</p>
									<p class="info-line-item">
										{{add_rate}}
									</p>
								</div>
								<div class="col-sm-12">
									<p class="info-line-item">
										加价后
									</p>
									<p class="info-line-item">
										{{new_rate}}
									</p>
								</div>
								<div class="col-sm-12">
									<p class="info-line-item">
										每100USDT收取
									</p>
									<p class="info-line-item">
										{{hands_rate}}
									</p>
								</div>
								<div class="col-sm-12" style="text-align: center">
									<div @click="saveRate" class="btn-chujin" style="min-width:200px;margin-top:40px;margin-left:10%;width:80%;height: 40px;line-height: 40px; text-align: center">
										确定
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="col-sm-4"></div>
				</div>

			</div>

		</div>
	</div>
</div>
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
<script th:src="@{/js/vue.min.js}"></script>
<script th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript">
    var this_rate = [[${this_rate}]];
    var vm = new Vue({
        el: '#dataBox',
        data: {
            this_rate:this_rate,
            old_add_rate:[[${old_add_rate}]],
            change: [[${old_add_rate}]] * 1000,
            add_rate: [[${old_add_rate}]],
            new_rate: Math.floor(([[${this_rate}]] + [[${old_add_rate}]]) * 10000) / 10000,
            hands_rate: Math.floor([[${old_add_rate}]] * 10000)/100
        },
        methods: {
            jian: function () {
                this.change -= 1;
                this.changeValue();
            },
            add: function () {
                this.change += 1;
                this.changeValue();
            },
            changeValue: function () {
                vm.add_rate= vm.change / 1000;
                vm.new_rate= Math.floor((this_rate + vm.add_rate) * 10000) / 10000;
                vm.hands_rate= Math.floor(vm.add_rate * 10000)/100;
            },
            saveRate: function () {
                $.ajax({
                    type: "POST",
                    url: ctx + "manager/set_rate",
                    data: {logicType:'in_rate',add_rate : vm.add_rate},
                    dataType: "json",
                    success: function (result) {
                        if (result.code == 0) {//登录成功
                            alert('设置成功');
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            }
        }
    });
</script>
</body>
</html>